﻿<%@ Page Title="" Language="C#" MasterPageFile="MasterPage.master" AutoEventWireup="true" CodeFile="NewsManagement.aspx.cs" Inherits="_wecaresvn_NewsManagement" %>

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder2" runat="Server">
    <div style="width: 960px; height:760px ;  margin:0 auto;background-color:#240101">

       
     
     <br />
         <div style="margin:0 auto;width:940px; height: 760px;border:none">
        <asp:DetailsView runat="server" AllowPaging="True" AutoGenerateRows="False" DataKeyNames="News_ID" DataSourceID="SqlDataSource2" Height="750px" Width="940px" BackColor="White" BorderColor="#CCCCCC" BorderStyle="None" BorderWidth="3px" CellPadding="4" ForeColor="Black" GridLines="Horizontal" HeaderStyle-BackColor="#371200" ID="dv1">
            <CommandRowStyle Font-Size="X-Large" HorizontalAlign="Center" />
            <EditRowStyle BackColor="#CC3333" Font-Bold="True" ForeColor="White" />
            <FieldHeaderStyle BorderStyle="None" HorizontalAlign="Center" Font-Bold="True" Font-Size="Large" />
            <Fields>
                <asp:BoundField DataField="News_ID" HeaderText="News_ID" InsertVisible="False" ReadOnly="True" SortExpression="News_ID" Visible="False" />
                <asp:BoundField DataField="News_Date" DataFormatString="{0:d}"  HeaderText="日期" SortExpression="News_Date" >
                <HeaderStyle Width="100px" BackColor="#990033" ForeColor="White" Font-Bold="True" Font-Size="Larger" />
                </asp:BoundField>
                <asp:BoundField DataField="News_Type" HeaderText="分類" SortExpression="News_Type" >
                <HeaderStyle BackColor="#990033" ForeColor="White" Font-Bold="True" Font-Size="Larger" />
                </asp:BoundField>
                <asp:BoundField DataField="News_Title" HeaderText="標題" SortExpression="News_Title" >
                <HeaderStyle BackColor="#990033" ForeColor="White" Font-Bold="True" Font-Size="Large" />
                </asp:BoundField>
                <asp:TemplateField HeaderText="內文" SortExpression="News_Date">
                    <EditItemTemplate>
                        <asp:TextBox ID="TextBox1"  runat="server"  Height="400px" Text='<%# Bind("News_Cont") %>' Width="800px"  TextMode="MultiLine"></asp:TextBox>
                    </EditItemTemplate>
                    <InsertItemTemplate>
                        <asp:TextBox ID="TextBox1" runat="server" Height="400px" Text='<%# Bind("News_Cont") %>' Width="800px" TextMode="MultiLine"></asp:TextBox>
                    </InsertItemTemplate>
                    <ItemTemplate>
                        <asp:Label ID="Label1" runat="server" Text='<%# Bind("News_Cont") %>'></asp:Label>
                    </ItemTemplate>
                    <HeaderStyle BackColor="#990033" Font-Bold="True" Font-Size="Large" ForeColor="White" />
                    <ItemStyle Height="500px" HorizontalAlign="Left" VerticalAlign="Top" />
                </asp:TemplateField>
                <asp:CommandField ShowDeleteButton="True" ShowEditButton="True" ShowInsertButton="True" ButtonType="Button">
                <ControlStyle BackColor="#990033" Font-Size="Larger" Font-Underline="False" ForeColor="White" Height="40px" Width="80px" />
                <FooterStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                <HeaderStyle ForeColor="White" />
                <ItemStyle BorderStyle="Double" HorizontalAlign="Center" VerticalAlign="Middle" BackColor="#990033" />
                </asp:CommandField>
                
            </Fields>
            <FooterStyle BackColor="#003300" ForeColor="White" />
            <HeaderStyle Font-Bold="True" ForeColor="#9900FF" Font-Size="Large" Font-Underline="False" />
            <PagerStyle BackColor="Black" Font-Size="X-Large" ForeColor="#CC3300" HorizontalAlign="Center" BorderStyle="None" />
            <RowStyle Height="50px" BackColor="White" BorderColor="#990033" Font-Size="Large" />
        </asp:DetailsView>
             </div>
        <br />
        <asp:SqlDataSource ID="SqlDataSource2" runat="server" ConnectionString="<%$ ConnectionStrings:MedicareConnectionString %>" DeleteCommand="DELETE FROM [News] WHERE [News_ID] = @News_ID" InsertCommand="INSERT INTO [News] ([News_Type], [News_Title], [News_Cont], [News_Date]) VALUES (@News_Type, @News_Title, @News_Cont, @News_Date)" SelectCommand="SELECT * FROM [News]" UpdateCommand="UPDATE [News] SET [News_Type] = @News_Type, [News_Title] = @News_Title, [News_Cont] = @News_Cont, [News_Date] = @News_Date WHERE [News_ID] = @News_ID" ProviderName="System.Data.SqlClient">
            <DeleteParameters>
                <asp:Parameter Name="News_ID" Type="Int32" />
            </DeleteParameters>
            <InsertParameters>
                <asp:Parameter Name="News_Type" Type="String" />
                <asp:Parameter Name="News_Title" Type="String" />
                <asp:Parameter Name="News_Cont"    Type="String"  />
                <asp:Parameter Name="News_Date" Type="DateTime" />
            </InsertParameters>
            <UpdateParameters>
                <asp:Parameter Name="News_Type" Type="String" />
                <asp:Parameter Name="News_Title" Type="String" />
                <asp:Parameter Name="News_Cont" Type="String" />
                <asp:Parameter Name="News_Date" Type="DateTime" />
                <asp:Parameter Name="News_ID" Type="Int32" />
            </UpdateParameters>
        </asp:SqlDataSource>
        <br />
        <br />
        <br />
    </div>
</asp:Content>

